package com.rex.goods.repository;

import com.rex.goods.entity.Goods;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 * Created by frt on 2017/11/2.
 *
 */
@CacheConfig(cacheNames = "goods")
public interface IGoodsRepository extends JpaRepository<Goods, Long> {
    @Cacheable(key = "#p0")
    Goods findByGoodsName(String goodsName);

    @CachePut(key = "#p0.id")
    Goods save(Goods goods);
}
